﻿using System;
using System.Windows;
using System.Windows.Media;

namespace Gmantis.Controls.Chart
{
    internal class RadarView
    {
        // Fields
        public double Angle;
        public Point Center;
        public SweepDirection Direction = SweepDirection.Clockwise;
        public bool IsPolar;
        public double Radius;

        // Methods
        public double GetAngle(double angle)
        {
            if (this.Direction == SweepDirection.Counterclockwise)
            {
                angle = -angle;
            }
            return ((angle + ((this.Angle * 3.1415926535897931) / 180.0)) - 1.5707963267948966);
        }

        public Rect GetAxisYRect(double h)
        {
            return new Rect(this.Center.X - h, this.Center.Y - this.Radius, this.Radius, h);
        }

        public void Init(Rect rc)
        {
            this.Radius = 0.5 * Math.Min(rc.Width, rc.Height);
            this.Center = new Point(rc.X + (0.5 * rc.Width), rc.Y + (0.5 * rc.Height));
        }
    }
}
